import requests

# url ='http://httpbin.org/get?name=xuxu'
# response = requests.get(url,params={
#     'age':21
# },headers={
#   'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0',
# }
# )
# print(response.headers['content-type'])
# print(response.text)
# print(response.status_code)
# print(response.json())
# print(response.text)
# print(response.request.headers)


url ='http://httpbin.org/post?name=xuxu'
response = requests.post(url,
params={
    'age':21
},headers={
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0',
    'content-type':'application/x-www-form-urlencoded'
},
data={
    'name':'wangxu',
    'age':20
}
#     json={'name':'wangxu','age':20}  # json格式，写进data
)
print(response.request.headers['Content-Type'])
print(response.json())

# print(response.json())
# print(response.request.headers)

# print(response.json()['headers'])








